import { reqAddressInfo, reqOrderInfo } from "@/api"
const actions = {
    // 获取用户地址信息
    async getUserAddress(context) {
        const result = await reqAddressInfo()
        if (result.code === 200) {
            context.commit("GETUSERADDRESS", result.data)
        }
    },
    // 获取商品清单的数据
    async getOrderInfo(context) {
        const result = await reqOrderInfo()
        if (result.code === 200) {
            context.commit("GETORDERINFO", result.data)
        }
    },
}
const mutations = {
    GETUSERADDRESS(state, addressInfo) {
        state.addressInfo = addressInfo
    },
    GETORDERINFO(state, orderInfo) {
        state.orderInfo = orderInfo
    },
}
const state = {
    addressInfo: [],
    orderInfo: {},
}
const getters = {}

export default {
    namespaced: true,
    actions,
    mutations,
    state,
    getters,
}
